package com.wzdigit.wms.ws.service.gdn.impl;
/*
 * @Author:yangwenbiao
 * @Date 2021/5/15 1:05 PM
 * @version 1.0
 */

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wzdigit.wms.ws.client.GdnHeaderReq;
import com.wzdigit.wms.ws.domain.GdnHeader;
import com.wzdigit.wms.ws.mapper.GdnHeaderMapper;
import com.wzdigit.wms.ws.service.gdn.GdnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.jws.WebService;


@Component
@WebService(name = "GdnService",
        targetNamespace = "http://impl.gdn.service.ws.wms.wzdigit.com",
        endpointInterface = "com.wzdigit.wms.ws.service.gdn.GdnService")
public class GdnServiceImpl implements GdnService {

    @Autowired
    GdnHeaderMapper gdnHeaderMapper;

    @Override
    public GdnHeader getGdnHeaderByGdnNo(String gdnNo) {

        //创建类型的条件构造器
        QueryWrapper<GdnHeader> wrapper = new QueryWrapper<>();
        wrapper.eq("GDN_NO",gdnNo );

        GdnHeader gdnHeader = gdnHeaderMapper.selectOne(wrapper);

        String string = JSON.toJSONString(gdnHeader);
        return gdnHeader;
    }

    @Override
    public GdnHeader getGdnHeaderByObj(GdnHeaderReq gdnHeaderReq) {
        //创建类型的条件构造器
        QueryWrapper<GdnHeader> wrapper = new QueryWrapper<>();
        wrapper.eq("GDN_NO",gdnHeaderReq.getGdnNo() );
        wrapper.eq("FACTORY",gdnHeaderReq.getFactory() );

        GdnHeader gdnHeader = gdnHeaderMapper.selectOne(wrapper);
        return gdnHeader;
    }

    @Override
    public GdnHeader getGdnHeaderByGdnNoAndFactory(String gdnNo, String factory) {
        //创建类型的条件构造器
        QueryWrapper<GdnHeader> wrapper = new QueryWrapper<>();
        wrapper.eq("GDN_NO",gdnNo );
        wrapper.eq("FACTORY",factory );

        GdnHeader gdnHeader = gdnHeaderMapper.selectOne(wrapper);
        return gdnHeader;
    }
}
